﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import flash.events.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class UpdateMorePetsArrowCommand extends Command {

        public var worldModel:WorldModel;
        public var gameStateModel:GameStateModel;
        public var userModel:UserModel;
        protected var _maxLevel:int = 5

        override public function execute():void{
            if (!this.worldModel.building){
                return;
            };
            var _local1:int = this.worldModel.doctors.length;
            var _local2:int = this.worldModel.patients.length;
            var _local3:String = this.worldModel.getRoomIdsOfType(GameConstants.TYPE_RECEPTION)[0];
            var _local4:IRoom = IRoom(this.worldModel.getRoomById(_local3));
            if ((((((((((_local2 < _local1)) && (this.gameStateModel.isRunning))) && ((this.userModel.level <= this._maxLevel)))) && (_local4.isFree))) && (!(this.userModel.isVisitFriendsMode())))){
                dispatch(new Event(EventConstants.ADD_MORE_PETS_ARROW));
            } else {
                dispatch(new Event(EventConstants.REMOVE_MORE_PETS_ARROW));
            };
        }

    }
}//package net.wooga.pets.controllers 
